//
// Created by liuml on 2018/10/18.
//

#ifndef XYMUSIC_XYCALLJAVA_H
#define XYMUSIC_XYCALLJAVA_H

#include "jni.h"
#include <linux/stddef.h>
#include "AndroidLog.h"

#define MAIN_THREAD 0
#define CHILD_THREAD 1
class XYCallJava{
public:
    JavaVM *javaVM = NULL;
    JNIEnv *jniEnv = NULL;
    jobject jobj;

    jmethodID  jmid_parpared;
    jmethodID  jmid_load;
    jmethodID  jmid_timeinfo;
    jmethodID  jmid_error;
    jmethodID  jmid_complete;
    jmethodID  jmid_volumedb;
    jmethodID  jmid_pcmtoaac;
    jmethodID  jmid_pcminfo;
    jmethodID  jmid_pcmrate;

public:
    XYCallJava(JavaVM *javaVM, JNIEnv *env, jobject *obj);
    ~XYCallJava();

    void onCallParpared(int type);

    void onCallLoad(int type, bool load);

    void onCallTimeInfo(int type, int curr, int total);

    void onCallError(int type, int code, char *msg);

    void onCallComplete(int type);

    void onCallVolumeDaB(int type, int db);

    void onCallPcmToAAC(int type, int size, void *buffer);

    void onCallPcmInfo(void *buffer, int size);

    void onCallPcmSamperate(int samperate);

};

#endif //XYMUSIC_XYCALLJAVA_H
